<html>
<head>
    <script src="html/jquery-2.1.4.js"></script>
    <script src="html/table2CSV.js"></script>
    <script rel="stylesheet" src="html/common.css"></script>
    <script>
        $(document).ready(function () {
            $('<a></a>')
                    .attr('id', 'downloadFile')
                    .attr('href', 'data:application/octet-stream;charset=utf8,' + encodeURIComponent($('#tabledata').table2CSV({delivery: 'value'})))
                    .attr('download', 'filename.csv')
                    .appendTo('body');

            $('#button').click(function () {
                $('#downloadFile').get(0).click();
            });

        });
    </script>
    <style>
        .green {
            color: green;
        }

        .red {
            color: red;
        }

        table {
            font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
            width: 70%;
            border-collapse: collapse;
        }

        td, th {
            font-size: 1em;
            border: 1px solid #98bf21;
            padding: 3px 7px 2px 7px;
        }

        th {
            font-size: 1.1em;
            text-align: left;
            padding-top: 5px;
            padding-bottom: 4px;
            background-color: darkblue;
            color: #ffffff;
        }

        tr:nth-child(2n+1) td {
            color: #000000;
            background-color: lightblue;
        }

        dt, dd {
            font-family: sans-serif;
        }

        dt {
            float: left;
            clear: left;
            text-align: left;
            width: 20%;
            color: #444444;
        }

        dd {
            float: left;
            margin-left: 15em;
            color: #444444;
        }
    </style>
    <title></title>
</head>
</html>
